package com.zmn.plat.business.impl.product;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.common.dto.StatusDTO;
import com.zmn.plat.business.interfaces.product.ServSubsidiaryGroupBService;
import com.zmn.plat.model.entity.product.ServSubsidiaryGroup;
import com.zmn.plat.services.interfaces.product.ServSubsidiaryGroupService;

/**
 * 描述:ServSubsidiaryGroupBServiceImpl
 *
 * @author tanghongjun
 * @since: 2018/10/16 17:56
 */
@Service
public class ServSubsidiaryGroupBServiceImpl implements ServSubsidiaryGroupBService {

    @Resource
    protected ServSubsidiaryGroupService servSubsidiaryGroupService;

    @Override
    public Integer updateStatus(Integer groupId, Integer status, String updater) {
        ServSubsidiaryGroup servSubsidiaryGroup = new ServSubsidiaryGroup();
        servSubsidiaryGroup.setGroupId(groupId);
        servSubsidiaryGroup.setStatus(status);
        servSubsidiaryGroup.setUpdater(updater);
        return this.updateStatus(servSubsidiaryGroup);
    }

    @Override
    public Integer updateStatus(ServSubsidiaryGroup servSubsidiaryGroup) {

        int pos = servSubsidiaryGroupService.updateStatus(servSubsidiaryGroup);

        return pos;
    }

    @SuppressWarnings("Duplicates")
    @Override
    public Integer updateStatusBatch(List<Integer> groupIds, Integer status, String updater) {
        StatusDTO dto = new StatusDTO();
        dto.setIds(groupIds);
        dto.setStatus(status);
        dto.setUpdater(updater);

        return this.updateStatusBatch(dto);
    }

    @Override
    public Integer updateStatusBatch(StatusDTO dto) {

        int pos = servSubsidiaryGroupService.updateStatusBatch(dto);

        return pos;
    }
}